package com.dg.controller;

import com.dg.common.ServerResponse;
import com.dg.dto.AclModuleDto;
import com.dg.param.AclModuleParam;
import com.dg.pojo.AclModule;
import com.dg.pojo.User;
import com.dg.service.AclModuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/aclmodule/")
public class AclModuleController {

    @Autowired
    private AclModuleService aclModuleService;

    @RequestMapping("list")
    public ServerResponse<List<AclModuleDto>> list(){
        return ServerResponse.createBySuccess(aclModuleService.list());
    }

    @RequestMapping("getAclModule")
    public ServerResponse<AclModuleDto> getAclModule(Integer id){
        return ServerResponse.createBySuccess(aclModuleService.getAclModule(id));
    }

    @RequestMapping("saveOrUpdate")
    public ServerResponse saveOrUpdate(AclModuleParam param){
        aclModuleService.saveOrUpdate(param);
        return ServerResponse.createBySuccess();
    }

    @RequestMapping("update")
    public ServerResponse update(AclModuleParam param){
        aclModuleService.update(param);
        return ServerResponse.createBySuccess();
    }



    @RequestMapping("delete")
    public ServerResponse delete(Integer id){
        aclModuleService.delete(id);
        return ServerResponse.createBySuccess();
    }

}
